import { generateUUIDv4 } from '@/util/utils'
import { ALL_COMPLETION_AVAILABLE_BLOCKS } from '../../constants'
import { BlockEnum, NodeDefault } from '@/components/workflow/types'
import { DocExtractorNodeType } from './types'
export const getExtractorDefaultParams = () => {
  return {
    inputList: [
      {
        variable: 'input', // 变量名
        value: undefined, // 变量值
        type: 'cite', // 变量类型 
        value_selector: [] // 变量值选择器
      }
    ], // 输入变量列表
    outputList: [
      {
        variable: 'output', // 变量名
        value: '文档提取输出', // 文档提取输出
        type: 'string', // 变量类型
      }
    ]
  }
}

const nodeDefault: NodeDefault<DocExtractorNodeType> = {
  defaultValue: { ...getExtractorDefaultParams() },
  getAvailablePrevNodes() {
    const nodes = ALL_COMPLETION_AVAILABLE_BLOCKS.filter(type => type !== BlockEnum.End)
    return nodes
  },
  getAvailableNextNodes() {
    const nodes = ALL_COMPLETION_AVAILABLE_BLOCKS
    return nodes
  },
  checkValid(payload: DocExtractorNodeType) {
    let isValid = true
    let errorMessages = ''
    if (payload.type) {
      isValid = true
      errorMessages = ''
    }
    return {
      isValid,
      errorMessage: errorMessages
    }
  }
}

export default nodeDefault